<template>
    <view class="page-login-index">
        <u-button type="primary" text="登录" @click="wxLogin">登录</u-button>
    </view>
</template>
<script setup lang="ts">
import { useAppStore } from '@/stores/app';
const appStore = useAppStore();
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
const wxLogin = async () => {
    appStore.wxLogin().then(res => {
        let url = uni.getStorageSync('beforeLogin');
        if(url){
            proxy.$util.gotoPage(url)
        }else{
            uni.switchTab({
                url: '/pages/home/index'
            })
        }
    });
}
</script> 